//
//  COCanvasLocalView.swift
//  CocoProject
//
//  Created by Vill on 2023/11/15.
//

import UIKit

class COCanvasLocalView: WMDragView {

    lazy var canvas: UIView = {
        let canva = UIView()
        canva.backgroundColor = UIColor.colorWithHex("#1E1E1E")
        canva.layer.cornerRadius = PTW(10)
        canva.clipsToBounds = true
        return canva
    }()
    
    lazy var flipBtn: UIButton = {
        let flip = UIButton()
        flip.isUserInteractionEnabled = false
        flip.setImage(KImaged("coco_video_exchange"), for: .normal)
        return flip
    }()
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        self.freeRect = CGRect(x: PTW(80), y: statusBarHeight + PTW(10), width: SCREENWIDTH - PTW(95), height: SCREENHEIGHT - statusBarHeight - KTabBarAndSafeHeight - PTW(20))
        self.isKeepBounds = true
        self.dragDirection = .vertical
        setUpUI()
    }
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    // 设置UI
    func setUpUI(){
        addSubview(canvas)
        addSubview(flipBtn)
        canvas.snp.makeConstraints { make in
            make.size.equalTo(CGSize(width: PTW(100), height: PTW(130)))
            make.centerX.top.equalToSuperview()
        }
        flipBtn.snp.makeConstraints { make in
            make.size.equalTo(PTW(30))
            make.centerX.equalTo(canvas)
            make.centerY.equalTo(canvas.snp.bottom)
        }
    }

}
